﻿Imports BookOrderingSystem.BOSDataSetTableAdapters

Public Class Index2
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If (Session("UserName") <> "administrator") Then
            Response.Redirect("~/Account/Login.aspx")
        End If
    End Sub

    Protected Sub gv_user_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles gv_user.RowDeleting
        Dim cadap As New CustomersTableAdapter
        Dim bsadap As New BookstoreOwnersTableAdapter

        Dim id As String = gv_user.Rows(e.RowIndex).Cells(1).Text()
        Dim userId As Integer = CInt(id)

        'Dim userId = gv_user.SelectedRow.Cells(1).ToString

        'Dim userId = (gv_user.Columns.Item("UserId").Value.ToString)
        'Dim ui As Integer = CInt(userId)
        cadap.Delete(userId)
        bsadap.Delete(userId)
    End Sub
End Class